import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import './assets/iconfont/iconfont.css'
//引入所有Elementplus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const de=(fn:any,delay:any)=>{
    let timer:any
    return (...args:any)=>{
        if(timer) clearTimeout(timer)
        timer=setTimeout(()=>{
            fn(...args)
        },delay)
    }
}
const _ResizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends _ResizeObserver{
constructor(callback:any) {
callback = de(callback, 200);
super(callback);
}
}

const app = createApp(App)
//通过app组件遍历所有的Elementplus图标  遍历一个注册一个
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router).mount('#app')